Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix string to bytes conversion (GIT8266O-868) #1290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

datxuantran
Copy link

Description

This pull request introduces a change to the save_segment method in esptool.py. The main modification ensures that the segment.data is properly encoded as bytes if it is provided as a string. This change addresses potential issues when writing segment data to the image file, ensuring compatibility and preventing runtime errors due to incorrect data types.

Motivation

This enhancement is crucial as it maintains data integrity when saving segments, especially when segment data may inadvertently be in string format. It allows for more robust handling of input data types, ensuring that the writing process to the image file functions smoothly without requiring external type checks.

Related

  • Fixes
  • Related pull requests:
  • Documentation link:

Testing

I tested the changes by creating a new virtual environment and running the esptool with various segment data types (both string and bytes). All tests confirmed that the save_segment method works correctly, successfully writing segment data to the image file without any type-related errors.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • [/] All CI checks (GH Actions) pass.
  • [/] Documentation is updated as needed.
  • [/] Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@CLAassistant
Copy link

CLAassistant commented Oct 8, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title Fix string to bytes conversion Fix string to bytes conversion (GIT8266O-868) Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants